| Total Complexity | 3 |
| Total Lines | 15 |
| Duplicated Lines | 0 % |
| Coverage | 60% |
| Changes | 0 | ||
| 1 | /** |
||
| 10 | class User extends Model { |
||
| 11 | constructor() { |
||
| 12 | 4 | super('user', [{ key: { username: 1 } }]); |
|
| 13 | } |
||
| 14 | |||
| 15 | add(user) { |
||
| 16 | 1 | const encryptPassword = authUtil.encryptPassword(user); |
|
| 17 | 1 | return super.add(Object.assign({}, user, { password: encryptPassword })); |
|
| 18 | } |
||
| 19 | |||
| 20 | updatePassword(username, newPassword) { |
||
| 21 | const encryptPassword = authUtil.encryptPassword({ username, password: newPassword }); |
||
| 22 | return super.updateWithQuery({ username }, { password: encryptPassword, isTemporary: false }); |
||
| 23 | } |
||
| 24 | } |
||
| 25 | |||
| 27 |